package com.lyl.security.module.login.controller;

import com.lyl.security.module.login.model.dto.LoginDTO;
import com.lyl.security.module.login.service.LoginService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Mr.Luo
 * @date 2022-09-14 15:44
 * @desc 登录控制器
 */
@RestController
@RequiredArgsConstructor
public class LoginController {
    private final LoginService loginService;

    @PostMapping("/login")
    public String login(@RequestBody LoginDTO dto) {
        return loginService.login(dto);
    }

    @GetMapping("/hello")
    //@PreAuthorize("hasAuthority('test:hello')")
    public String hello(){
        return "hello,world";
    }
}
